package com.pro.common.service.websocket.model.base;

import com.pro.baoyi.common.api.enums.EnumEnumLoginEntranceBaoyi;
import com.pro.common.service.websocket.model.dto.WebsocketClientTokenKey;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class WebsocketClientToken implements Serializable {
    private static final long serialVersionUID = 17596023951234L;
    @Schema(description = "用户ID")
    private Long userId;

    @Schema(description = "登录入口")
    private String loginEntrance = EnumEnumLoginEntranceBaoyi.DEFAULT.name();

    @Schema(description = "Token")
    private String token;

    @Schema(description = "客户端ID")
    private String clientId;

    @Schema(description = "上次活跃时间")
    private LocalDateTime lastActiveTime;

   public WebsocketClientTokenKey toKey() {
        return new WebsocketClientTokenKey(userId, loginEntrance);
    }
}
